/*
 * @Author: guo-chengjiang 1029833238@qq.com
 * @Date: 2025-03-31 10:30:13
 * @LastEditors: guo-chengjiang 1029833238@qq.com
 * @LastEditTime: 2025-04-09 22:49:04
 * @FilePath: \online-exam-system\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

// 导入 Vue 和 VueRouter
import Vue from 'vue';
import VueRouter from 'vue-router';
import MainView from '@/views/MainView.vue';
import HomeView from '@/views/HomeView.vue';
import QuestionList from '@/views/QuestionList.vue';
import QuestionCategory from '@/views/QuestionCategory.vue';
import PaperList from '@/views/PaperList.vue';
import PaperAdd from '@/views/PaperAdd.vue';
import PaperDetail from '@/views/PaperDetail.vue';
import ExamList from '@/views/ExamList.vue';
import ExamDetail from '@/views/ExamDetail.vue';
import StudentManage from '@/views/StudentManage.vue';
import StudentDetail from '@/views/StudentDetail.vue';
import StatisticsExam from '@/views/StatisticsExam.vue';
import StatisticsPaper from '@/views/StatisticsPaper.vue';
import StatisticsExamDetail from '@/views/StatisticsExamDetail.vue';
import StatisticsPaperDetail from '@/views/StatisticsPaperDetail.vue';
import SafeView from '@/views/SafeView.vue';
import PersonMessage from '@/views/PersonMessage.vue';
import PersonComplain from '@/views/PersonComplain.vue';
import PersonBasic from '@/views/PersonBasic.vue';
import PersonPassword from '@/views/PersonPassword.vue';
import ExamApproval from '@/views/ExamApproval.vue';
import ExamMonitor from '@/views/ExamMonitor.vue';
import ApprovalPage from '@/views/ApprovalPage.vue';
import ApprovalDetail from '@/views/ApprovalDetail.vue';
import MonitorDetail from '@/views/MonitorDetail.vue';
import LoginView from '@/views/LoginView.vue';

// 使用 VueRouter 插件
Vue.use(VueRouter);

// 定义路由配置
const routes = [
  {
    path: '/',
    redirect: '/login' // 根路径重定向到登录页
  },
  {
    path: '/login',
    name: 'Login',
    component: LoginView,
    meta: { title: '登录',}
  },
  {
    path: '/main',
    component: MainView,
    children: [
      {
        path: '',
        redirect: 'home'
      },
      {
        path: 'home',
        name: 'Home',
        component: HomeView
      },
      {
        path: 'question-bank',
        name: 'QuestionBank',
        component: { render: h => h('router-view') },
        children: [
          {
            path: 'category',
            name: 'QuestionCategory',
            component: QuestionCategory,
            meta: { title: '题目分类' }
          },
          {
            path: 'list',
            name: 'QuestionList',
            component: QuestionList,
            meta: { title: '题目列表' }
          }
        ]
      },
      {
        path: 'paper-manage',
        name: 'PaperManage',
        component: { render: h => h('router-view') },
        children: [
          {
            path: 'list',
            name: 'PaperList',
            component: PaperList,
            meta: { title: '试卷列表' }
          },
          {
            path: 'add',
            name: 'PaperAdd',
            component: PaperAdd,
            meta: { title: '新增试卷' }
          },
          {
            path: 'detail',
            name: 'PaperDetail',
            component: PaperDetail,
            meta: { title: '试卷详情' }
          },
        ]
      },
      {
        path: 'exam-manage',
        name: 'ExamManage',
        component: { render: h => h('router-view') },
        children: [
          {
            path: 'list',
            name: 'ExamList',
            component: ExamList,
            meta: { title: '考试列表' }
          },
          {
            path: 'detail',
            name: 'ExamDetail',
            component: ExamDetail,
            meta: { title: '考试详情' }
          },
          {
            path: 'approval',
            name: 'ExamApproval',
            component: ExamApproval,
            meta: { title: '考试审批' }
          },
          {
            path: 'monitor',
            name: 'ExamMonitor',
            component: ExamMonitor,
            meta: { title: '考试监控' }
          },
          {
            path: 'page',
            name: 'ApprovalPage',
            component: ApprovalPage,
            meta: { title: '审批页' }
          },
          {
            path: 'detail',
            name: 'ApprovalDetail',
            component: ApprovalDetail,
            meta: { title: '详情页' }
          },
          {
            path: 'details',
            name: 'MonitorDetail',
            component: MonitorDetail,
            meta: { title: '详情页' }
          },
        ]
      }, 
      {
        path: 'student-manage',
        name: 'StudentManage',
        component: StudentManage
      }, 
      {
        path: 'student-detail',
        name: 'StudentDetail',
        component: StudentDetail
      }, 
      {
        path: 'statistics',
        name: 'Statistics',
        component: { render: h => h('router-view') },
        children: [
          {
            path: 'exam',
            name: 'StatisticsExam',
            component: StatisticsExam,
            meta: { title: '考试分析' }
          },
          {
            path: 'detail1',
            name: 'StatisticsExamDetail',
            component: StatisticsExamDetail,
            meta: { title: '详情' }
          },
          {
            path: 'paper',
            name: 'StatisticsPaper',
            component: StatisticsPaper,
            meta: { title: '试卷分析' }
          },
          {
            path: 'detail2',
            name: 'StatisticsPaperDetail',
            component: StatisticsPaperDetail,
            meta: { title: '详情' }
          },
        ]
      },
      {
        path: 'system',
        name: 'Syetem',
        component: { render: h => h('router-view') },
        children: [
          {
            path: 'safe',
            name: 'SafeView',
            component: SafeView,
            meta: { title: '题目分类' }
          },
      
        ]
      },
      {
        path: 'person',
        name: 'Person',
        component: { render: h => h('router-view') },
        children: [
          {
            path: 'message',
            name: 'PersonMessage',
            component: PersonMessage,
            meta: { title: '消息提醒' }
          },
          {
            path: 'complain',
            name: 'PersonComplain',
            component: PersonComplain,
            meta: { title: '投诉反馈' }
          },
          {
            path: 'basic',
            name: 'PersonBasic',
            component: PersonBasic,
            meta: { title: '基本信息' }
          },
          {
            path: 'password',
            name: 'PersonPassword',
            component: PersonPassword,
            meta: { title: '密码修改' }
          },
        ]
      },
    ]
  },
];

// 创建路由实例
const router = new VueRouter({
  mode: 'hash', // 使用 hash 模式
  routes
});


// 导出路由实例
export default router;